package com.dpj.book.service.impl;

import com.dpj.book.mapper.BookMapper;
import com.dpj.book.pojo.Book;
import com.dpj.book.service.BookService;
import com.dpj.book.utils.SqlSessionFactoryUtils1;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import java.util.List;

public class BookServiceImpl implements BookService {
    SqlSessionFactory sessionFactory = SqlSessionFactoryUtils1.getSessionFactory();
    @Override
    public List<Book> SelectAllBooks() {
        SqlSession sqlSession = sessionFactory.openSession(true);
        BookMapper mapper = sqlSession.getMapper(BookMapper.class);
        List<Book> books=mapper.selectAllBooks();
        return books;
    }
}
